package studio.servletinstrument;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import studio.excepcion.DAOExcepcion;
import studio.negocio.SeguridadInstrumento;

/**
 * Servlet implementation class actualizaIntru
 */
public class actualizaIntru extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public actualizaIntru() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		int idInstru=Integer.parseInt(request.getParameter("idInstru"));
		int idTip=Integer.parseInt(request.getParameter("tipInstr"));
		int idMarca=Integer.parseInt(request.getParameter("marca"));
		int idmodelo=Integer.parseInt(request.getParameter("modelo"));
		String carac=request.getParameter("caracte");
		int cant=Integer.parseInt(request.getParameter("cantidad"));
		Double cost=Double.parseDouble(request.getParameter("costo"));
		String serie=request.getParameter("serie");
		SeguridadInstrumento objIntr = new SeguridadInstrumento();
		try {
			int idNroArmado=0;
			idNroArmado=objIntr.actualizarInstrumento(idInstru,idTip, idMarca, idmodelo,carac, cant,0,cost ,serie);
			response.sendRedirect(request.getContextPath() + "/ListadoInstrumento.jsp");
		} catch (DAOExcepcion e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
